package com.example.administrator.imageselected;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.widget.Button;
import android.widget.ImageView;

import com.bumptech.glide.Glide;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import butterknife.ButterKnife;
import butterknife.InjectView;

/**
 * Created by Chen qin lang on 2016/12/20.
 * 邮箱 :   619766577@qq.com
 */
public class CarInfoActivity extends AppCompatActivity {

    @InjectView(R.id.select_iv_idcardposition1)
    ImageView selectIvIdcardposition1;
    @InjectView(R.id.select_arrmedphoto1)
    ImageView selectArrmedphoto1;
    @InjectView(R.id.select_iv_idcardback1)
    ImageView selectIvIdcardback1;
    @InjectView(R.id.home_call_police1)
    ImageView homeCallPolice1;
    @InjectView(R.id.select_iv_carinfo1)
    ImageView selectIvCarinfo1;
    @InjectView(R.id.home_insurance1)
    ImageView homeInsurance1;
    @InjectView(R.id.bottom1)
    Button bottom1;
    private ArrayList<File> files;
    private List<ImageView> imageViews=new ArrayList();

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.inject(this);
        initImageLists();

    }

    private void initImageLists() {

        imageViews.add(selectIvIdcardposition1);
        imageViews.add(selectIvIdcardback1);
        imageViews.add(selectIvCarinfo1);
        imageViews.add(selectArrmedphoto1);
        imageViews.add(homeCallPolice1);
        imageViews.add(homeInsurance1);
        Intent intent = getIntent();
        PeopleInfomation people = (PeopleInfomation) intent.getSerializableExtra("people");
        files = people.files;
        for (int i = 0; i < files.size(); i++) {
            if (files.get(i).length() > 0) {
                Glide.with(this).load(files.get(i)).into(imageViews.get(i));
            }
        }
    }
}
